//
//  ChooseCameraManViewController.m
//  XDBaseFrameWork
//
//  Created by xindao on 14-9-19.
//  Copyright (c) 2014年 XD-XY. All rights reserved.
//

#import "ChooseCameraManViewController.h"
#import "CameraManCell.h"
#import "CameraManDetailViewController.h"

#import "SynthesizeDetailsViewController.h"

@interface ChooseCameraManViewController ()
{
    UILabel * tmpLabel;
}
@end

@implementation ChooseCameraManViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

-(void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    if (_type){
        locService.delegate = nil;
    }
}

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:YES];
    if (_type) {
        locService.delegate = self;
        showLB.hidden = YES;
        [locService startUserLocationService];
    }else{
    
    }
    
}

-(void)backPrePage
{
    if (_type){
        [locService stopUserLocationService];
        locService.delegate = nil;
    }
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.titleLabel.text = @"选摄影师";

    dataArray = [[NSMutableArray alloc] init];
    changjingDataArray = [[NSMutableArray alloc] init];
    cityDataArray = [[NSMutableArray alloc] init];

    isFirst = YES;
    
    currentPage = 1;

    cityID = @"";
    taocanID = @"";
    otherType = @"";
    
    [self createTabs];
    [self getDataWithDict:nil api:API_CHANGJINGINFO];
    [self getDataWithDict:nil api:API_CITYINFO];
    
    myTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, UI_NAVIGATION_BAR_HEIGHT, UI_SCREEN_WIDTH, UI_MAINSCREEN_HEIGHT-3*UI_NAVIGATION_BAR_HEIGHT) style:UITableViewStylePlain];
    if (_type) {
        myTableView.frame = CGRectMake(0, UI_NAVIGATION_BAR_HEIGHT, UI_SCREEN_WIDTH, UI_MAINSCREEN_HEIGHT-2*UI_NAVIGATION_BAR_HEIGHT);
    }
    myTableView.dataSource = self;
    myTableView.delegate = self;
    myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    myTableView.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:myTableView];


//    chooseView = [[ChooseView alloc] initWithFrame:CGRectMake(0, UI_NAVIGATION_BAR_HEIGHT, UI_SCREEN_WIDTH, UI_MAINSCREEN_HEIGHT-UI_NAVIGATION_BAR_HEIGHT)];
//    chooseView.delegate = self;
//    chooseView.hidden = YES;
//    [self.contentView addSubview:chooseView];

    showLB = [UILabel initLabelText:nil andRect:CGRectMake(0,  myTableView.bounds.size.height+UI_NAVIGATION_BAR_HEIGHT, UI_SCREEN_WIDTH, UI_NAVIGATION_BAR_HEIGHT) andBackGroudColor:UIColorFromRGB(0xededed) andTextFont:[UIFont systemFontOfSize:13] andTextColor:UIColorFromRGB(0x929292) andTextAlignment:NSTextAlignmentCenter];
    showLB.hidden = YES;
    [self.contentView addSubview:showLB];
    
    mScreenView = [[ScreenView alloc] initWithFrame:CGRectMake(0, UI_NAVIGATION_BAR_HEIGHT, UI_SCREEN_WIDTH, self.contentView.bounds.size.height-UI_NAVIGATION_BAR_HEIGHT)];
    mScreenView.delegate = self;
    [self.contentView addSubview:mScreenView];
    [mScreenView hiddenTheScreenView];

    
    if (!_type){
        NSDictionary * dict = @{@"Lat": self.lat,
                                @"Lng": self.lng,
                                @"PMID":self.iphotoMode,
                                @"Time":self.timeID,
                                @"SceneID":self.SceneID
                                };
        [self getDataWithDict:dict api:API_CAMRAMANLIST];
        [XDTools showProgress:self.contentView];
        
    }else{
        
        locService = [[BMKLocationService alloc] init];
        
        locService.delegate  =self;
        
        [locService startUserLocationService];
        
        if ([XDTools sharedXDTools].longitude&&[XDTools sharedXDTools].latitude){
            NSDictionary * dict = @{@"Lat": [NSString stringWithFormat:@"%f",[XDTools sharedXDTools].latitude],
                                    @"Lng": [NSString stringWithFormat:@"%f",[XDTools sharedXDTools].longitude]};
            [XDTools showProgress:self.contentView];
            [self getDataWithDict:dict api:API_CAMRAMANLIST];
        }else{
            [XDTools showTips:@"请在隐私中打开定位服务" toView:self.view];
        }
        
    }
}



- (void)createTabs{
    UIView * bgView = [UIView initViewRect:CGRectMake(0, 0, UI_SCREEN_WIDTH, UI_NAVIGATION_BAR_HEIGHT) andBackGroudColor:UIColorFromRGB(0xd9d9d9)];
    [self.contentView addSubview:bgView];

    NSArray * nameArray = @[@"分类",@"全城",@"综合排序"];
    for (int i = 0; i < 3; i++) {

        float h = 106;
        if (i == 2) {
            h = 113;
        }

        UIImageView * sanjiao = [[UIImageView alloc] initWithFrame:CGRectMake(74+i*h, 20, 8, 4)];
        sanjiao.image = [UIImage imageNamed:@"downsanjiao_dark"];
        sanjiao.tag = 866700+i;
        [bgView addSubview:sanjiao];

        UIButton * btn  = [UIButton initButton:CGRectMake(106*i, 0, 106, UI_NAVIGATION_BAR_HEIGHT) btnNorImage:nil btnHighlightImage:nil btnTitle:nameArray[i] titleColor:RGBA(108, 108, 108, 1) titleFont:[UIFont systemFontOfSize:15]];
        btn.tag = 187200+i;
        [btn addTarget:self action:@selector(chooseType:) forControlEvents:UIControlEventTouchUpInside];
        [bgView addSubview:btn];

        if (i) {
            UIView * line = [UIView initViewRect:CGRectMake(106*i, 3, 1, 38) andBackGroudColor:UIColorFromRGB(0xcacaca)];
            [bgView addSubview:line];
        }

        UIView * line2 = [UIView initViewRect:CGRectMake(0, 43.5f, UI_SCREEN_WIDTH, .5f) andBackGroudColor:RGBA(228, 228, 220, 1)];
        [bgView addSubview:line2];
    }
}


-(void)getDataWithDict:(NSDictionary *)dict api:(NSString *)api
{
    if (![XDTools NetworkReachable]) {
        [XDTools hideProgress:self.contentView];
        [XDTools showTips:brokenNetwork toView:self.contentView];
        return;
    }

    __weak ASIHTTPRequest *request = [XDTools postRequestWithDict:dict API:api];
    [request setCompletionBlock:^{
        if ([api isEqualToString:API_CAMRAMANLIST]) {
            [XDTools hideProgress:self.contentView];
            contentIsOK = YES;
        }else if ([api isEqualToString:API_CHANGJINGINFO]) {
            typeIsOK = YES;
        }else{
            cityIsOK = YES;
        }

        if (!_type) {
            if (cityIsOK && contentIsOK) {
                [XDTools hideProgress:self.contentView];
            }
        }else{
            if (cityIsOK && typeIsOK && contentIsOK) {
                [XDTools hideProgress:self.contentView];
            }

        }

        NSDictionary *tempDic = [XDTools  JSonFromString:[request responseString]];

        if([[tempDic objectForKey:@"status"]intValue] == 1){

            DDLOG(@"dic = %@",tempDic);

            if ([api isEqualToString:API_CAMRAMANLIST]) {
                totalCount = [tempDic[@"data"][@"Count"] intValue];

                if (currentPage == 1) {
                    dataArray = [NSMutableArray arrayWithArray:tempDic[@"data"][@"List"]];
                }else{
                    [dataArray addObjectsFromArray:tempDic[@"data"][@"List"]];
                }

                if (dataArray.count == totalCount) {
                    totalCount = -999;
                }

                if (dataArray.count < 6) {
                    showLB.text = [NSString stringWithFormat:@"根据您的筛选条件搜索到%d名摄影师，换个条件试试？",dataArray.count];
                }else{
                    showLB.text = [NSString stringWithFormat:@"根据您的筛选条件搜索到%d名摄影师。",dataArray.count];
                }
                
                if (isFirst && _type) {
                    showLB.text = [NSString stringWithFormat:@"现在共有%d名摄影师供您筛选。",dataArray.count];
                    isFirst = NO;
                }
                showLB.attributedText = [XDTools getAcolorfulStringWithTextArray:@[[NSString stringWithFormat:@"%d",dataArray.count]] Color:UIColorFromRGB(0xff6000) Font:[UIFont systemFontOfSize:18] AllText:showLB.text];
                if (!_type) {
                    showLB.hidden = NO;
                }
                
                [myTableView reloadData];
            }else if ([api isEqualToString:API_CHANGJINGINFO]) {
                if (!_type){
                    for (NSDictionary * dict in tempDic[@"data"]){
                        if ([self.SceneID isEqualToString:dict[@"SceneID"]]){
                            changjingDataArray = [[NSMutableArray alloc] init];
                            [changjingDataArray addObject:dict];
                            
                            UIButton * btn = (UIButton *)[self.view viewWithTag:187200];
                            [btn setTitle:dict[@"SceneName"] forState:UIControlStateNormal];
                            UIImageView * sanjiao = (UIImageView *)[self.view viewWithTag:866700];
                            sanjiao.frame = [self autoResizeFrameWithTextNumber:[dict[@"SceneName"] length] btnNumber:0];
                            break;
                        }
                    }

                }else{
                    changjingDataArray = [NSMutableArray arrayWithArray:tempDic[@"data"]];
                }
            }else{
                cityDataArray = [NSMutableArray arrayWithArray:tempDic[@"data"]];
            }



        }else{
            [XDTools showTips:tempDic[@"msg"] toView:self.view];

        }

    }];

    [request setFailedBlock:^{
        if ([api isEqualToString:API_CAMRAMANLIST]) {
            contentIsOK = YES;
        }else if ([api isEqualToString:API_CHANGJINGINFO]) {
            typeIsOK = YES;
        }else{
            cityIsOK = YES;
        }
        [XDTools hideProgress:self.contentView];
//        if (!_type) {
//            if (cityIsOK && contentIsOK) {
//                [XDTools hideProgress:self.contentView];
//            }
//        }else{
//            if (cityIsOK && typeIsOK && contentIsOK) {
//                [XDTools hideProgress:self.contentView];
//            }
//        }
    }];
    [request startAsynchronous];
}



- (void)showTypesView:(UIButton *)sender{

    if (sender.tag == 187200) {
        if ([chooseView.type isEqualToString:@"taocan"] && !chooseView.hidden) {
            chooseView.hidden = YES;
            [self makeSanJiaoWithImage:[UIImage imageNamed:@"downsanjiao_dark"]];
            UIImageView * sanjiao = (UIImageView *)[self.view viewWithTag:866700];
            sanjiao.image = [UIImage imageNamed:@"downsanjiao_dark"];
        }else{
            UIButton * btn = (UIButton *)[self.contentView viewWithTag:187200];
            [chooseView showWithType:@"taocan" array:changjingDataArray title:btn.titleLabel.text];
            [self makeSanJiaoWithImage:[UIImage imageNamed:@"downsanjiao_dark"]];
            UIImageView * sanjiao = (UIImageView *)[self.view viewWithTag:866700];
            sanjiao.image = [UIImage imageNamed:@"upsanjiao_dark"];
        }
    }else if (sender.tag == 187201) {
        if ([chooseView.type isEqualToString:@"dizhi"] && !chooseView.hidden) {
            chooseView.hidden = YES;
            [self makeSanJiaoWithImage:[UIImage imageNamed:@"downsanjiao_dark"]];
            UIImageView * sanjiao = (UIImageView *)[self.view viewWithTag:866701];
            sanjiao.image = [UIImage imageNamed:@"downsanjiao_dark"];
        }else{
            UIButton * btn = (UIButton *)[self.contentView viewWithTag:187201];
            [chooseView showWithType:@"dizhi" array:cityDataArray title:btn.titleLabel.text];
            [self makeSanJiaoWithImage:[UIImage imageNamed:@"downsanjiao_dark"]];
            UIImageView * sanjiao = (UIImageView *)[self.view viewWithTag:866701];
            sanjiao.image = [UIImage imageNamed:@"upsanjiao_dark"];
        }
    }else{
        if ([chooseView.type isEqualToString:@"other"] && !chooseView.hidden) {
            chooseView.hidden = YES;
            [self makeSanJiaoWithImage:[UIImage imageNamed:@"downsanjiao_dark"]];
            UIImageView * sanjiao = (UIImageView *)[self.view viewWithTag:866702];
            sanjiao.image = [UIImage imageNamed:@"downsanjiao_dark"];
        }else{
            UIButton * btn = (UIButton *)[self.contentView viewWithTag:187202];
            [chooseView showWithType:@"other" array:nil title:btn.titleLabel.text];
            [self makeSanJiaoWithImage:[UIImage imageNamed:@"downsanjiao_dark"]];
            UIImageView * sanjiao = (UIImageView *)[self.view viewWithTag:866702];
            sanjiao.image = [UIImage imageNamed:@"upsanjiao_dark"];
        }
    }
}

- (void)makeSanJiaoWithImage:(UIImage *)image{
    UIImageView * sanjiao1 = (UIImageView *)[self.view viewWithTag:866700];
    sanjiao1.image = image;
    UIImageView * sanjiao2 = (UIImageView *)[self.view viewWithTag:866701];
    sanjiao2.image = image;
    UIImageView * sanjiao3 = (UIImageView *)[self.view viewWithTag:866702];
    sanjiao3.image = image;
//    UIImageView * sanjiao4 = (UIImageView *)[self.view viewWithTag:866703];
//    sanjiao4.image = image;
}


#pragma mark - UITableView Datasource
//- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
//    return dataArray.count;
//}
//
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return dataArray.count;
}

//- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
//    return 10;
//}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 80;
}

//- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
//    UIView * bgView = [UIView initViewRect:CGRectMake(0, 0, UI_SCREEN_WIDTH, 10) andBackGroudColor:[UIColor clearColor]];
//    return bgView;
//}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    NSString * cellIde = @"cell";
    CameraManCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIde];
    if (!cell) {
        cell = [[CameraManCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIde];
        cell.backgroundColor = [UIColor whiteColor];
    }

    NSDictionary * dict = dataArray[indexPath.row];

    [cell initViewsWithDict:dict];

    return cell;
}

#pragma mark - UITableView Delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    if(!_type){ //从选择场景进来
        if (ISLOGING){
            
            //单例存储用户信息
            //存储用户手机号
            [XDTools sharedXDTools].iphoneNumber = [[NSUserDefaults standardUserDefaults] valueForKey:kMY_USER_IPHONE];
            //存储用户ID
            [XDTools sharedXDTools].CustomerID = [[NSUserDefaults standardUserDefaults] objectForKey:kMY_USER_ID];
            //摄影师ID
            [XDTools sharedXDTools].EmplID = dataArray[indexPath.row][@"EmplID"];
            
            SynthesizeDetailsViewController * synvc = [[SynthesizeDetailsViewController alloc] init];
            if ([dataArray[indexPath.row][@"IsAuthen"] intValue]) {
                synvc.isrenzheng = YES;
            }else{
                synvc.isrenzheng = NO;
            }
            [self.navigationController pushViewController:synvc animated:YES];
        }else{
            loginViewController * loginVC = [[loginViewController alloc] init];
            [self.navigationController pushViewController:loginVC animated:YES];
        }

    }else{
        CameraManDetailViewController * cameraMan = [[CameraManDetailViewController alloc] init];
        cameraMan.cameraManID = dataArray[indexPath.row][@"EmplID"];
//        cameraMan.type = _type;
        if ([dataArray[indexPath.row][@"IsAuthen"] intValue]) {
            cameraMan.isRenZheng = YES;
        }else{
            cameraMan.isRenZheng = NO;
        }
        [self.navigationController pushViewController:cameraMan animated:YES];
    }

}

#pragma mark - ChooseView Delegate
- (void)chooseType:(NSString *)type data:(NSDictionary *)dict{

    chooseView.hidden = YES;

    if ([type isEqualToString:@"hide"]) {
        [self makeSanJiaoWithImage:[UIImage imageNamed:@"downsanjiao_dark"]];
        return;
    }

    if ([type isEqualToString:@"dizhi"]) {
        cityID = dict[@"CityID"];
        UIButton * btn = (UIButton *)[self.contentView viewWithTag:187201];
        [btn setTitle:dict[@"CityName"] forState:UIControlStateNormal];
        UIImageView * sanjiao = (UIImageView *)[self.view viewWithTag:866701];
        sanjiao.frame = [self autoResizeFrameWithTextNumber:[dict[@"CityName"] length] btnNumber:1];
    }else if ([type isEqualToString:@"taocan"]) {
        taocanID = dict[@"SceneID"];
        UIButton * btn = (UIButton *)[self.contentView viewWithTag:187200];
        [btn setTitle:dict[@"SceneName"] forState:UIControlStateNormal];
        UIImageView * sanjiao = (UIImageView *)[self.view viewWithTag:866700];
        sanjiao.frame = [self autoResizeFrameWithTextNumber:[dict[@"SceneName"] length] btnNumber:0];
    }else if ([type isEqualToString:@"other"]){
        otherType = dict[@"type"];
        UIButton * btn = (UIButton *)[self.contentView viewWithTag:187202];
        [btn setTitle:dict[@"name"] forState:UIControlStateNormal];
        UIImageView * sanjiao = (UIImageView *)[self.view viewWithTag:866702];
        sanjiao.frame = [self autoResizeFrameWithTextNumber:[dict[@"name"] length] btnNumber:2];
    }
    
    
    NSDictionary * dic;
    if (!_type){
        dic = @{@"Lat": self.lat,
                @"Lng": self.lng,
                @"PMID":self.iphotoMode,
                @"Time":self.timeID,
                @"SceneID":self.SceneID,
                @"RegionID":cityID,
                otherType:@"1"};
        
    }else{
       dic = @{@"Lat": [NSString stringWithFormat:@"%f",latitude],
               @"Lng": [NSString stringWithFormat:@"%f",longitude],
               @"RegionID":cityID,
               @"SceneID":taocanID,
               otherType:@"1"};
    }

    [self makeSanJiaoWithImage:[UIImage imageNamed:@"downsanjiao_dark"]];


    [self getDataWithDict:dic api:API_CAMRAMANLIST];

}

//根据文字个数重置三角的位置
- (CGRect)autoResizeFrameWithTextNumber:(int)textNum btnNumber:(int)btnNum{
    CGRect frame;
    if (textNum == 2) {
        frame = CGRectMake(74+btnNum*106, 20, 10, 6);
    }else if (textNum == 3) {
        frame = CGRectMake(78+btnNum*106, 20, 10, 6);
    }else{
        frame = CGRectMake(84+btnNum*106, 20, 10, 6);
    }
    return frame;
}

#pragma mark
#pragma mark 百度地图 定位 回调
/**
 *在停止定位后，会调用此函数
 */
- (void)didStopLocatingUser
{
    NSLog(@"停止定位");
}

/**
 *用户方向更新后，会调用此函数
 *@param userLocation 新的用户位置
 */
- (void)didUpdateUserHeading:(BMKUserLocation *)userLocation
{
    latitude = userLocation.location.coordinate.latitude;
    longitude = userLocation.location.coordinate.longitude;
    if (latitude>0&&longitude>0){
        [locService stopUserLocationService];
        [XDTools sharedXDTools].latitude = latitude;
        [XDTools sharedXDTools].longitude = longitude;
        
    }
}

/**
 *用户位置更新后，会调用此函数
 *@param userLocation 新的用户位置
 */
- (void)didUpdateUserLocation:(BMKUserLocation *)userLocation
{
    latitude = userLocation.location.coordinate.latitude;
    longitude = userLocation.location.coordinate.longitude;
    if (latitude>0&&longitude>0){
        [locService stopUserLocationService];
        [XDTools sharedXDTools].latitude = latitude;    //经度
        [XDTools sharedXDTools].longitude = longitude;  //纬度
        
    }
}

/**
 *定位失败后，会调用此函数
 *@param mapView 地图View
 *@param error 错误号，参考CLError.h中定义的错误号
 */
- (void)mapView:(BMKMapView *)mapView didFailToLocateUserWithError:(NSError *)error
{
    NSLog(@"location error");
}




#pragma mark
#pragma mark ScreenView  Delegate
-(void)whileScreenViewIsHidden:(NSDictionary *)mdict isReflash:(BOOL)reflash
{
    
    NSString * titleName = mdict[@"SceneName"];
    NSString * titleid =mdict[@"SceneID"];
    
    if ([myTableView isHeaderRefreshing]){
        [myTableView headerEndRefreshing];
    }
    if([myTableView isFooterRefreshing]){
        [myTableView footerEndRefreshing];
    }
    
    if(!tmpLabel){
        tmpLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 20)];
        tmpLabel.numberOfLines = 0;
        tmpLabel.font = [UIFont boldSystemFontOfSize:17.0f];
    }
    tmpLabel.frame = CGRectMake(0, 0, 200, 20);
    tmpLabel.text = titleName;
    [tmpLabel sizeToFit];
    
//    titleIV.image = LOADIMAGE(@"downicon@2x");
//    self.titleLabel.text = titleName;
//    CGRect rect = titleIV.frame;
//    rect.origin.x = 160+tmpLabel.frame.size.width/2.0f+2;
//    titleIV.frame = rect;
//    
//    if (reflash){
//        SceneID = titleid;
//        page = 1;
//        [self performSelector:@selector(reflashDatas) withObject:self afterDelay:0];
//    }
}

-(void)reflashDatas
{
    //根据新条件筛选数据
//    [self getListDatas:1];
}

#pragma mark
#pragma mark 选择场景
-(void)chooseType:(UIButton *)sender
{
    
    NSArray * arr = @[@"taocan",@"dizhi",@"other"];
    
    if (mScreenView.isHidden){
        mScreenView.selectName = sender.titleLabel.text;
        [self changeData:sender];
        [mScreenView showTheScreenView];
    }else{
        if ([arr[sender.tag-187200] isEqualToString:mScreenView.type]) {
            [mScreenView hiddenTheScreenView];
            [self makeSanJiaoWithImage:[UIImage imageNamed:@"downsanjiao_dark"]];
        }else{
            mScreenView.selectName = sender.titleLabel.text;
            [self changeData:sender];
            [mScreenView showTheScreenView];
        }
        

    }
    
    //    [filterView showTheView];
}

- (void)changeData:(UIButton *)sender{
    [self makeSanJiaoWithImage:[UIImage imageNamed:@"downsanjiao_dark"]];

    UIImageView * iv = (UIImageView *)[self.view viewWithTag:sender.tag-187200+866700];
    iv.image = LOADIMAGE(@"upicon@2x");
    
    switch (sender.tag-187200) {
        case 0:
        {
            mScreenView.type = @"taocan";
            mScreenView.dataArray = changjingDataArray;
        }
            break;
        case 1:
        {
            mScreenView.type = @"dizhi";
            mScreenView.dataArray = cityDataArray;
        }
            break;
        case 2:
        {
            mScreenView.type = @"other";
            mScreenView.dataArray = [NSMutableArray arrayWithArray:@[@{@"name":@"综合排序",@"type":@""},
                                                                     @{@"name":@"离我最近",@"type":@"Range"},
                                                                     @{@"name":@"接单量",@"type":@"OrderCount"},
                                                                     @{@"name":@"好评率",@"type":@"ReviewAvg"},
                                                                     @{@"name":@"价格最高",@"type":@"PriceTop"},
                                                                     @{@"name":@"价格最低",@"type":@"PriceLow"}]];
        }
        default:
            break;
    }
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
